<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/template/template2.xhtml">
	<ui:define name="content1">
		<div class="container">
			<h:form id="loginForm">
				<p:growl id="growl" sticky="true" />
				<h:panelGrid class="table" columns="2" id="loginPanel" rendered="#{!userBean.loggedIn}">
				
					<h:outputLabel value="Username" />
					<p:inputText id="username" value="#{userBean.username}" />

					<h:outputLabel value="Password"></h:outputLabel>
					<p:password id="password" value="#{userBean.password}" />



					<p:commandButton value="Reset" actionListener="#{userBean.reset}"
						ajax="true" update="loginForm"/>
					<p:commandButton value="Log in" actionListener="#{userBean.login}"
						ajax="true" update="loginForm" />
				
				</h:panelGrid>
				<h:panelGrid class="table" columns="2" id="housePanel" rendered="#{userBean.loggedIn}">
					<h:outputLabel value="HouseID" />
					<p:selectOneMenu disabled="#{!userBean.loggedIn}"
						value="#{userBean.selectedHouse}" var="h" style="width:200px">
						<f:selectItem itemLabel="Select one" itemValue="" />
						<f:selectItems value="#{userBean.houseList}" var="house"
							itemLabel="#{house.houseName}" itemValue="#{house.houseId}" />
						<p:column>
							<p:graphicImage value="resources/images/safehouse.jpg" width="40"
								height="50" />
						</p:column>

						<p:column>  
						#{house.houseName}
           				 </p:column>
					</p:selectOneMenu>

					<p:commandButton value="Reset" actionListener="#{userBean.reset}"
						ajax="true" update="loginForm"/>
					<p:commandButton disabled="#{!userBean.loggedIn}" value="Continue"
						action="#{userBean.loginCont}" ajax="false" />

				</h:panelGrid>
			</h:form>
		</div>






	</ui:define>
</ui:composition>
